'use strict'

exports.reply = function* (next) {
	var message = this.weixin

	if (message.MsgType ==='event') {
		if (message.Event ==='subscribe') {
			if (message.EventKey) {
				console.log('扫二维码进来：' + message.EventKey + '' + message.ticket)
			}
			this.body = '哈哈，你订阅了这个号' 
		}
		else if (message.Event ==='unsubscribe') {
			console.log('无情取关')
			this.body = ''
		}
		else if(message.Event ==='LOCATION'){
			this.body = '你上报的地理位置是：' + message.Latitude +'./' + message.Longitude +'-' +message.Precision

		}
		else if (message.Event ==='CLICK') {
			this.body = '你点击了菜单' + message.EventKey

		}
		else if (message.Event ==='SCAN') {
			console.log('关注后扫描二维码'+ message.EventKey +'' +message.Ticket)
			this.body = '看到你扫一下哦'
		}
		else if (message.Event ==='VIEW') {
			this.body = '你点击了菜单中的链接' + message.EventKey
		}
	}
	else if (message.MsgType ==='text') {
		var content = message.Content
		var reply = '你说的'+ message.Content +'太复杂了'

		if (content ==='1') {
			reply = '越越最票列'
		}else if (content ==='2') {
			reply = '越越熄火我'
		}else if (content ==='3') {
			reply = '我熄火越越'
		}else if (content ==='4') {
			reply = '一个的'
		}else if (content ==='越越') {
			reply = [{
				title:'越越票列',
				description:'小姐姐我想',
				picUrl:'http://a2.qpic.cn/psb?/V11au6xe0q7lD7/5XZjQgrFtL7qNgkTw*yJE*Rkmf1LRwXnMF9CrrYw3jk!/b/dBYGyUUaGQAA&bo=gAJVAwAAAAABB*Q!&rf=viewer_4',
				url:'https://user.qzone.qq.com/1173312509?ptlang=2052&source=aiostar'
			}]
		}else if (content ==='劳列') {
			reply = [{
				title:'劳列最帅',
				description:'劳列帅的一踏赵',
				picUrl:'http://b11.photo.store.qq.com/psb?/V13noB8u3Psl5b/G.xhwOYCEpC3iDInE399NzgdYM.HgI8u3qeMp3895h0!/b/dAsAAAAAAAAA&bo=4AGAAgAAAAABB0M!&t=5&w=216&h=289&rf=travel&t=5',
				url:'https://user.qzone.qq.com/534184571?ptlang=2052&source=aiostar'
			}]
		}else if (content ==='小西') {
			reply = [{
				title:'小西最美',
				description:'小西马元一枝花',
				picUrl:'http://a3.qpic.cn/psb?/V11au6xe42kt3f/JlzQah9zEGjs*91EngNlPrKTty1WLQ.QV4*VCr0Cz88!/b/dFUurVHmKgAA&bo=gAJVAwAAAAABB*Q!&rf=viewer_4',
				url:'https://user.qzone.qq.com/1592869169/infocenter?ptsig=kFdl-RhKzNMefQzBIZkL4DzQNXLFbyFjiDkvkZFTptc_'
			}]
		}
		this.body = reply
	}

	yield next
}